

let arr = [1,2,3,4,5]
let obj={
    arr :[1,2,3,4,5]
}
let max = 0
let min = 0

//求数组最大值
//Math.max
max = Math.max(...arr)
console.log(max) // 5

//用Math.max.call
max = Math.max.call(null,...arr)
console.log(max) // 5

//用Math.max.apply
max = Math.max.apply(null,arr)
console.log(max) // 5

//求对象obj中属性arr的最大值
max = Math.max(...Object.values(obj.arr))
console.log(max) // 5

max = Math.max.call(null,...Object.values(obj.arr))
console.log(max) // 5

max = Math.max.apply(null,Object.values(obj.arr))
console.log(max) // 5